home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / uupc11ys.zip / LIB / MKMBOX.C < prev    next >
C/C++ Source or Header  |  1992-11-27  |  3KB  |  73 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    m k m b o x . h                                                 */
  3. /*                                                                    */
  4. /*    Host Support routines for UUPC/extended                         */
  5. /*                                                                    */
  6. /*    Changes Copyright 1990, 1991 (c) Andrew H. Derbyshire           */
  7. /*                                                                    */
  8. /*    History:                                                        */
  9. /*       21Nov1991 Break out of hlib.c                         ahd    */
  10. /*--------------------------------------------------------------------*/
  11.  
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include <time.h>
  16.  
  17. /*--------------------------------------------------------------------*/
  18. /*                    UUPC/extended include files                     */
  19. /*--------------------------------------------------------------------*/
  20.  
  21. #include "lib.h"
  22. #include "hlib.h"
  23.  
  24. /*--------------------------------------------------------------------*/
  25. /*                          Global variables                          */
  26. /*--------------------------------------------------------------------*/
  27.  
  28. currentfile();
  29.  
  30. /*--------------------------------------------------------------------*/
  31. /*    m k m a i l b o x                                               */
  32. /*                                                                    */
  33. /*    Build a mailbox name                                            */
  34. /*--------------------------------------------------------------------*/
  35.  
  36. char *mkmailbox(char *buf, const char *userid)
  37. {
  38.    boolean append = ( E_mailext != NULL );
  39.  
  40.    if (buf == NULL)           /* Do we need to allocate buffer?         */
  41.    {
  42.       buf = malloc( FILENAME_MAX );
  43.       checkref(buf);
  44.    } /* if */
  45.  
  46.    if (bflag[F_DIRECT])
  47.    {
  48.       sprintf(buf,"%s%c%s%c%s", E_maildir, SEPCHAR,
  49.                                userid, SEPCHAR,"newmail");
  50.    } /* if (bflag[F_DIRECT]) */
  51.    else {
  52.       char tuser[FILENAME_MAX];
  53.       strcpy( tuser, userid );
  54.  
  55.       if (strchr(userid, '.') == NULL )
  56.          tuser[8] = '\0';        /* Auto-truncate mbox name          */
  57.       else
  58.          append = FALSE;
  59.  
  60.       mkfilename(buf, E_maildir, tuser);
  61.    } /* else */
  62.  
  63. /*--------------------------------------------------------------------*/
  64. /*              If we need a mailbox extension, add one               */
  65. /*--------------------------------------------------------------------*/
  66.  
  67.    if ( append )
  68.       strcat( strcat(buf,".") , E_mailext );
  69.  
  70.    return buf;
  71.  
  72. } /* mkmailbox */
  73.